package com.robot.base.view.binding;

import android.graphics.Typeface;
import android.util.TypedValue;
import android.widget.TextView;

import androidx.databinding.BindingAdapter;

public class TextViewBinding {

    @BindingAdapter("android:setTextSize")
    public static void setTextSize(TextView textView, float textSize) {
        textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize);
    }

    @BindingAdapter("android:setTextBold")
    public static void setTextBold(TextView textView, boolean bold) {
        if (bold) {
            textView.setTypeface(Typeface.DEFAULT_BOLD);
        } else {
            textView.setTypeface(Typeface.DEFAULT);
        }
    }
}
